package com.example.demo.service;

import lombok.extern.slf4j.Slf4j;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Controller;
import org.springframework.stereotype.Service;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: 张杰
 * Date: 2022-08-01
 * Time: 17:40
 */
@Controller
@ResponseBody
@Slf4j // 替代了之前需要通过 LoggerFactory.getLogger 操作
public class UserService {
    /*//1.得到日志对象
    private static final Logger log =
            LoggerFactory.getLogger(UserService.class);*/
    @RequestMapping("/sayhi2")
    // lombok 会自动生成 private static final Logger log =
    //            LoggerFactory.getLogger(UserService.class);
    //        因此可以直接使用log
    public void sayHi2() {
        log.trace("我是 trace");
        log.debug("我是 debug");
        log.info("我是 info");
        log.warn("我是 warn");
        log.error("我是 error");
    }

}
